<?php
namespace Macaca\View;

use Monkey;

class Base {

    public
        /**
         * @var \Monkey\App
         */
        $app,
        /**
         * @var \Monkey\View\View
         */
        $view,
        $data = array(),
        $tpl;

    /**
     * @param Monkey\App $app
     */
    public function __construct($app) {
        $this->app = $app;
        $this->view = $app->view();
        $this->data['url_front'] = $app->FRONT_ROOT_URL;
    }

    /**
     * 渲染输出
     * @param array $data
     * @return string
     */
    public function render(array $data = array()) {
        return $this->view->setVariable($data + $this->data)->render($this->tpl, false);
    }

} 